package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject {

    private int state=-1;

    private Long destId=-1L;

    private int perExpendType=-1; //人均消费

    private int travelTimeType=-1; //出发时间

    private int dayType=-1; //出行天数

    private int orderType=1; //默认按最新排序

    public String getOrderBy(){
        if(orderType == 1){
            return "t.createTime desc"; //最新
        }else{
            return "t.viewnum desc"; //最热门
        }
    }

    //将页面传入key值转化为范围对象
    public TravelCondition getDay(){

        return TravelCondition.TRAVEL_DAYS.get(dayType);
    }

    public TravelCondition getPerExpend(){

        return TravelCondition.TRAVEL_PRE_EXPENDS.get(perExpendType);
    }

    public TravelCondition getTravelTime(){

        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }


}
